package com.kefu.boss.vo;

import com.kefu.boss.model.BossUser;
import lombok.Data;

import java.util.List;
import java.util.stream.Collectors;

/**
 * Created by A on 17/4/2024 - 下午 9:49
 */
@Data
public class BossUserVo extends BossUser {

    private String createUserName;

    public static List<BossUserVo> convert(List<BossUser> records) {
        // 将 List<BossUser> 转换为 List<BossUserVo>
        return records.stream().map(record -> {
            BossUserVo vo = new BossUserVo();
            vo.setUserId(record.getUserId());
            vo.setUserName(record.getUserName());
            vo.setUserPwd(record.getUserPwd());
            vo.setRoleList(record.getRoleList());
            vo.setCreateTime(record.getCreateTime());
            vo.setUserEmail(record.getUserEmail());
            vo.setUserStatus(record.getUserStatus());
            vo.setCreateUser(record.getCreateUser());
            vo.setCreateUserName(""); // 这里设置创建用户名
            return vo;
        }).collect(Collectors.toList());
    }
}
